package done.easy_1001_1100;

import com.study.common.*;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import static com.study.util.LogUtil.info;

/**
 * 树的左侧视图
 * <p>
 * 返回从左侧看树的所有可见节点
 * <p>
 * 例1：
 * 1
 * / \
 * 2   3
 * /   / \
 * 4   5   6
 * / \
 * 7  8
 * /
 * 9
 * 输入：
 * 输出：
 * [1, 2, 4, 7, 9]
 * <p>
 * 2019-03-19 11:28 PM
 **/
@Slf4j
public class LeftTreeNodeView {

    @SuppressWarnings("all")
    public ListNode leftView(TreeNode root) {
        // 190405 first
        // 190406 second
        // 190531 third 忘了怎么写了，重新做呢
        return null;
    }

    @Test
    public void test() {
        info(leftView(new TreeNode(1,
                new TreeNode(2,
                        4),
                new TreeNode(3,
                        5, new TreeNode(6,
                        7, new TreeNode(8,
                        9))))));
    }
}

































/*
public ListNode leftView(TreeNode root) {
    if (root==null) {
        return null;
    }

    ListNode result = new ListNode(root.val);
    result.next = mergeListNode(leftView(root.left), leftView(root.right));
    return result;
}

private ListNode mergeListNode(ListNode left, ListNode right) {
    if (left==null)
        return right;

    if (right==null)
        return left;

    ListNode res = new ListNode();
    ListNode cur = res;
    while (left!=null) {
        cur.next = left;
        left = left.next;
        if (right!=null)
            right = right.next;
        cur = cur.next;
    }
    cur.next = right;
    return res.next;
}
*/
